//-----------------------------------------------------------------------
// <copyright file="CompanyAndTypeComService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class CompanyAndTypeComService
    {
        #region CompanyAndTypeCom

        public static void CreateCompanyAndTypeCom(CompanyAndTypeCom companyAndTypeCom)
        {            
            try
            {
                CompanyAndTypeComDAO companyAndTypeComDAO = new CompanyAndTypeComDAO();
                companyAndTypeComDAO.CreateCompanyAndTypeCom(companyAndTypeCom);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateCompanyAndTypeComException, ex);
            }
        }        

        public static void UpdateCompanyAndTypeCom(CompanyAndTypeCom companyAndTypeCom)
        {            
            try
            {
                CompanyAndTypeComDAO companyAndTypeComDAO = new CompanyAndTypeComDAO();
                companyAndTypeComDAO.UpdateCompanyAndTypeCom(companyAndTypeCom);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateCompanyAndTypeComException, ex);
            }
        }        

        public static void DeleteCompanyAndTypeCom(int companyAndTypeComID)
        {            
            try
            {
                CompanyAndTypeComDAO companyAndTypeComDAO = new CompanyAndTypeComDAO();
                companyAndTypeComDAO.DeleteCompanyAndTypeCom(companyAndTypeComID);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteCompanyAndTypeComException, ex);
            }
        }
        
        public static CompanyAndTypeCom GetCompanyAndTypeCom(int companyAndTypeComID)
        {            
            try
            {
                CompanyAndTypeComDAO companyAndTypeComDAO = new CompanyAndTypeComDAO();
                return companyAndTypeComDAO.GetCompanyAndTypeCom(companyAndTypeComID);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndTypeComException, ex);
            }
        }                

        public static CompanyAndTypeComCollection GetCompanyAndTypeComList(CompanyAndTypeComColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                CompanyAndTypeComDAO companyAndTypeComDAO = new CompanyAndTypeComDAO();
                return companyAndTypeComDAO.GetCompanyAndTypeComList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndTypeComListException, ex);
            }
        }        

        public static CompanyAndTypeComCollection GetCompanyAndTypeComList(CompanyAndTypeComColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                CompanyAndTypeComDAO companyAndTypeComDAO = new CompanyAndTypeComDAO();
                return companyAndTypeComDAO.GetCompanyAndTypeComList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndTypeComListException, ex);
            }
        }        

	    public static CompanyAndTypeComCollection GetCompanyAndTypeComListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                CompanyAndTypeComDAO companyAndTypeComDAO = new CompanyAndTypeComDAO();
                return companyAndTypeComDAO.GetCompanyAndTypeComListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndTypeComListException, ex);
            }
        }        

        public static CompanyAndTypeComCollection GetCompanyAndTypeComListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                CompanyAndTypeComDAO companyAndTypeComDAO = new CompanyAndTypeComDAO();
                return companyAndTypeComDAO.GetCompanyAndTypeComListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetCompanyAndTypeComListException, ex);
            }
        }        

        #endregion
    }
}